package com.atwjy.config.Exception;

import com.atwjy.common.Result.ResultCodeEnum;
import lombok.Data;

@Data
public class GuiguException extends RuntimeException  {
    private Integer code;
    private String message;

    public GuiguException(Integer code,String message){
        super(message);
        this.code=code;
        this.message=message;
    }
    /**
     * 接收枚举类型对象
     * @param resultCodeEnum
     */
    public GuiguException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }

    @Override
    public String toString() {
        return "GuliException{" +
                "code=" + code +
                ", message=" + this.getMessage() +
                '}';
    }
}
